package design_8_filter.demo1.filter.impl;

import design_8_filter.demo1.entity.User;
import design_8_filter.demo1.filter.UserFilter;

import java.util.ArrayList;
import java.util.List;

/**
 * 过滤 姓名为王五的数据
 *
 * @author wangsong
 * @email 1720696548@qq.com
 * @date 2022/4/14 18:43
 */
public class UserUserNameFilter implements UserFilter {

	@Override
	public List<User> filter(List<User> users) {
		List<User> newUsers = new ArrayList<>();
		for (User user : users) {
			if (!user.getName().equals("王五")) {
				newUsers.add(user);
			}
		}
		return newUsers;
	}
}